#include <stdio.h>
#include <string.h>

void reverse(char* left, char* right)
{
	while (left < right)
	{
		char temp = *left;
		*left = *right;
		*right = temp;
		left++;
		right--;
	}
}
int main()
{
	char str[30];
	gets_s(str);
	size_t len = strlen(str);
	//reverse(str, str + len - 1);
	char* start = str;
	while (*start)
	{
		char* end = start;
		while (*end != ' ' && *end != '\0')
		{
			end++;
		}
		reverse(start, end-1);
		if (*end == ' ')
			start = end + 1;
		else
			start = end;
	}
	printf("%s\n", str);
	return 0;
}